import SubTitle from "@/pages/OrderModule/common/components/SubTitle";
import { Alert, Space, Switch } from "antd";
import {} from "react";

const AutoGetWaybill = ({ data, handUpDateBaseConfigData }) => {
	const { autoGetTrackingNumber } = data;
	const renderAlertMsg = () => {
		return (
			<div>
				<div>开启：则修改快递，会自动获取运单号</div>
				<div>关闭：则修改快递，不会自动获取运单号</div>
			</div>
		);
	};

	//开关切换
	const handleSwitch = e => {
		handUpDateBaseConfigData({
			autoGetTrackingNumber: e ? 1 : 0
		});
	};

	return (
		<Space direction="vertical" size={20}>
			<SubTitle title="信息详情" as="s2" />
			<Alert message={renderAlertMsg()} type="info" showIcon />
			<SubTitle
				title={
					<>
						是否自动获取运单号：
						<Switch
							checkedChildren="已开启"
							unCheckedChildren="已关闭"
							checked={autoGetTrackingNumber}
							onClick={e => handleSwitch(e)}
							size="default"
						/>
					</>
				}
				symbol
				as="s2"
			/>
		</Space>
	);
};
export default AutoGetWaybill;
